<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>座位抽奖系统</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            background-color: #f0f0f0;
            padding: 20px;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            background-color: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }

        button {
            font-size: 18px;
            padding: 12px 24px;
            margin: 10px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: transform 0.2s;
        }

        #start {
            background-color: #4CAF50;
            color: white;
        }

        #pause {
            background-color: #f44336;
            color: white;
        }

        button:hover {
            transform: scale(1.05);
        }

        #result {
            font-size: 48px;
            font-weight: bold;
            color: #2196F3;
            margin: 30px 0;
            min-height: 60px;
        }

        #winnerList {
            list-style: none;
            padding: 0;
            max-height: 300px;
            overflow-y: auto;
        }

        #winnerList li {
            font-size: 18px;
            padding: 8px;
            border-bottom: 1px solid #ddd;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>座位抽奖系统</h1>
        <div id="result">等待抽奖...</div>
        <button id="start" onclick="startLottery()">开始抽奖</button>
        <button id="pause" onclick="pauseLottery()" disabled>暂停</button>
        
        <h2>中奖名单</h2>
        <ul id="winnerList"></ul>
    </div>

    <script>
        let isDrawing = false;
        let timer = null;
        let winners = new Set();

        function generateSeat() {
            // 生成列（A-L 共12列）
            const column = String.fromCharCode(65 + Math.floor(Math.random() * 12));
            // 生成排（1-13）
            const row = Math.floor(Math.random() * 13) + 1;
            return `${column}${row.toString().padStart(2, '0')}`;
        }

        function startLottery() {
            if (winners.size >= 12 * 13) {
                alert("所有座位都已抽完！");
                return;
            }

            isDrawing = true;
            document.getElementById('start').disabled = true;
            document.getElementById('pause').disabled = false;

            timer = setInterval(() => {
                let seat;
                do {
                    seat = generateSeat();
                } while (winners.has(seat));
                
                document.getElementById('result').textContent = seat;
            }, 50);
        }

        function pauseLottery() {
            if (isDrawing) {
                clearInterval(timer);
                isDrawing = false;
                const currentSeat = document.getElementById('result').textContent;
                
                if (!winners.has(currentSeat)) {
                    winners.add(currentSeat);
                    const li = document.createElement('li');
                    li.textContent = `${currentSeat} - ${new Date().toLocaleTimeString()}`;
                    document.getElementById('winnerList').appendChild(li);
                }

                document.getElementById('start').disabled = false;
                document.getElementById('pause').disabled = true;
            }
        }
    </script>
</body>
</html>